package com.ruoyi.security.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.security.mapper.AfVesselMapper;
import com.ruoyi.security.domain.AfVessel;
import com.ruoyi.security.service.IAfVesselService;

/**
 * 压力容器台账Service业务层处理
 *
 * @author Felix
 * @date 2021-10-12
 */
@Service
public class AfVesselServiceImpl implements IAfVesselService {
    @Autowired
    private AfVesselMapper afVesselMapper;

    /**
     * 查询压力容器台账
     *
     * @param id 压力容器台账ID
     * @return 压力容器台账
     */
    @Override
    public AfVessel selectAfVesselById(String id) {
        return afVesselMapper.selectAfVesselById(id);
    }

    /**
     * 查询压力容器台账列表
     *
     * @param afVessel 压力容器台账
     * @return 压力容器台账
     */
    @Override
    public List<AfVessel> selectAfVesselList(AfVessel afVessel) {
        return afVesselMapper.selectAfVesselList(afVessel);
    }

    /**
     * 新增压力容器台账
     *
     * @param afVessel 压力容器台账
     * @return 结果
     */
    @Override
    public int insertAfVessel(AfVessel afVessel) {
        afVessel.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        afVessel.setCreateTime(DateUtils.getNowDate());
        afVessel.setCreateBy(SecurityUtils.getUsername());
        return afVesselMapper.insertAfVessel(afVessel);
    }

    /**
     * 修改压力容器台账
     *
     * @param afVessel 压力容器台账
     * @return 结果
     */
    @Override
    public int updateAfVessel(AfVessel afVessel) {
        afVessel.setUpdateTime(DateUtils.getNowDate());
        afVessel.setUpdateBy(SecurityUtils.getUsername());
        return afVesselMapper.updateAfVessel(afVessel);
    }

    /**
     * 批量删除压力容器台账
     *
     * @param ids 需要删除的压力容器台账ID
     * @return 结果
     */
    @Override
    public int deleteAfVesselByIds(String[] ids) {
        return afVesselMapper.deleteAfVesselByIds(ids);
    }

    /**
     * 删除压力容器台账信息
     *
     * @param id 压力容器台账ID
     * @return 结果
     */
    @Override
    public int deleteAfVesselById(String id) {
        return afVesselMapper.deleteAfVesselById(id);
    }
}
